Function Reference

ProcessClose

Terminates a named process.

ProcessClose ( "process" [, flag] )

 

Parameters

process The title or PID of the process to terminate.
flag [optional] if different from zero will force closing of handles to child stream if any defined in the Run() execution. process must be defined as a PID.

 

Return Value

None.

 

Remarks

Process names are executables without the full path, e.g., "notepad.exe" or "winword.exe"

If multiple processes have the same name, the one with the highest PID is terminated--regardless of how recently the process was spawned.

PID is the unique number which identifies a Process. A PID can be obtained through the ProcessExists or Run commands.

In order to work under Windows NT 4.0, ProcessClose requires the file PSAPI.DLL (included in the AutoIt installation directory).

The process is polled approximately every 250 milliseconds.

 

Related

ProcessExists, ProcessWait, ProcessWaitClose, Run, WinClose

 

Example


ProcessClose("notepad.exe")

$PID = ProcessExists("notepad.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)